package IT05;

import java.util.ArrayList;
import java.util.List;

public class ListDemo02 {
    public static void main(String[] args) {
        List<Student> list = new ArrayList<>();
        Student s1 = new Student("蜡笔小新", 45);
        Student s2 = new Student("迪迦", 45);
        Student s3 = new Student("路飞", 45);
        list.add(s1);
        list.add(s2);
        list.add(s3);
        //用增强for：
        for(Student s : list){
            System.out.println(s.getName()+","+s.getAge());
        }
    }
}
